package es.cazadoresmadridejos.web.tags;

import java.io.IOException;
import java.util.Date;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.SimpleTagSupport;

import es.cazadoresmadridejos.util.constants.Constants;

public class FormatDate extends SimpleTagSupport {


	
	private Date value;
	private Boolean time = false; 

	public Boolean getTime() {
		return time;
	}

	public void setTime(Boolean time) {
		this.time = time;
	}

	public Date getValue() {
		return value;
	}

	public void setValue(Date value) {
		this.value = value;
	}


	public void doTag() throws JspException , IOException{
		String result = (time)?Constants.sdfTime.format(value):Constants.sdf.format(value);
		
		JspWriter out = getJspContext().getOut();
		out.println(result);
	}

}
